'Also this code is FREE so please do with it as you see fit
'
'The procedure is really simple, just use a timer control to call
'the Drawlines Sub which counts the current lines in a Rich text box
'and finds the 1st visible line, and the current line
'then it uses the print function to display the line numbers.
'Also to speed things up, the Drawlines Sub is called when the user
'interacts with the Rich text Box.
'have fun :) Bryan Cairns
'http://www.html-helper.com
'cairnsb@html-helper.com
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_GETLINECOUNT = &HBA
Private Const EM_LINEINDEX = &HBB
Private Const EM_LINELENGTH = &HC1
Private Const EM_GETFIRSTVISIBLELINE = &HCE
Private Sub DrawLines(picTo As PictureBox, RTF As RichTextBox)
Dim iLine As Long, cLine As Long, vLine As Long
'count the lines
iLine = SendMessage(RTF.hwnd, EM_GETLINECOUNT, ByVal 0&, ByVal 0&)